package cn.tedu._03mybatis.mapper;

import cn.tedu._03mybatis.pojo.entity.Comment;
import cn.tedu._03mybatis.pojo.vo.CommentVO1;
import cn.tedu._03mybatis.pojo.vo.CommentVO2;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CommentMapper {
    @Insert("insert into comment(content,created,user_id,weibo_id) values " +
            "(#{content},#{created},#{userId},#{weiboId})" )
    void insertComment(Comment comment);

    @Delete("delete from comment where id = #{id}")
    int deleteById(Long id);

    @Update("update comment set content = #{content},created = #{created},user_id = #{userId},weibo_id = #{weiboId} where id = #{id}")
    void updateById(Comment comment);

    @Select("select content,user_id userId,weibo_id weiboId from comment where id = #{id}")
    List<CommentVO1> selectCommentById1(Long id);


    @Select("select content,user_id userId from comment where id = #{id}")
    List<CommentVO2> selectCommentById2(Long id);
}